import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import CounsellorView from '../views/counsellor/AttendListForCounsellor.vue'
import ClassTopListView from '../views/counsellor/ClassTopListView.vue'
import AttendListView from '../components/AttendListView.vue'
import TeacherHome from '../views/teacher/TeacherHome.vue'
import Attend from '../views/attendant/Attend.vue'
import AttenderHome from '../views/attendant/AttenderHome.vue'
import AttendListOfClazz from '../views/attendant/AttendListOfClazz.vue'
import TopScoresOfStudentByClazzId from '../views/attendant/TopScoresOfStudentByClazzId.vue'
import ListOfCourseAndCLazz from '../views/teacher/ListOfCourseAndCLazz.vue'
import AttendListByTeacher from '../views/teacher/AttendListByTeacher.vue'
import CounsellorHome from '../views/counsellor/CounsellorHome.vue'
import AttendListForCounsellor from '../views/counsellor/AttendListForCounsellor.vue'
import AttendenceDetailForCounsellor from '../views/counsellor/AttendenceDetailForCounsellor.vue'


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [

    {
      path: '/',
      name: 'home',
      component: HomeView
    },
 
    {path:'/counsellor/:id',//某辅导员某学期（2302 代表23-24第二学期）
      name:'counsellor',
      component:CounsellorHome,
      children:[
        {
          // 某学期班级考勤分排行如
          path: 'toplist_of_clazzes',
          component: ClassTopListView,
        },
        {
          // 
          // 所有考勤表list链接(按时间倒序)
          path: 'attend_list',
          component: AttendListForCounsellor,
        },{
          // 
          // 查看考勤表详情，如果是未归档考勤表，可以操作归档功能）
          path: 'attend_:attendId(.*)',
          component: AttendenceDetailForCounsellor,
        }
      ]
    },
    {
      path: '/attender/:id/',
      name: 'attender',
      component: AttenderHome,
     
      children: [
        {
          //班级考勤 
          path: 'attend',
          alias: '/',
          component: Attend
        },
        {
          // 本班考勤表list
          path: 'class_attend_lists',
          component: AttendListOfClazz,
        },
        {
          //本班学生考勤排行榜
          path: 'class_toplist',
          component: TopScoresOfStudentByClazzId,
        },
      ],
    },


    {
      path: '/teacher/:id',
      name: 'teacher',
      component: TeacherHome,
      children:[
          {
            //所授课程和班级组合列表 
            path: '/',
            component: TeacherHome
          },
          {
            //所授课程和班级组合列表 
            path: 'courses_and_clazzes/',
            component: ListOfCourseAndCLazz
          },
          {
          // 
          // 该老师的所有考勤表列表（降序排列）
          path: 'attend_list/',
          component: AttendListByTeacher,
          }
      ]
    },


    
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue')
    }
  ]
})

export default router
